/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test;


import aptech.eproject.logictics.dao.an.BookingHistoryManageRemote;

import aptech.eproject.logictics.dao.kien.LoginServiceRemote;

import aptech.eproject.logictics.dao.thinh.*;
import aptech.eproject.logictics.dao.thinh.ManageTrip.AddTripRemote;
import aptech.eproject.logictics.dao.thinh.ManageTrip.ManageTripRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author HOANGTHINH
 */
public class Util {

    public static RouteManageRemote lookupRouteService() {
        try {
            Context c = new InitialContext();
            return (RouteManageRemote) c.lookup("stateless/ManageRouteJNDI");
        } catch (NamingException ne) {
            System.err.println("Namming not found ...");
            throw new RuntimeException(ne);
        }
    }





    public static DeliveryStatusManageRemote lookupDeliveryStatusService() {

        try {
            Context c = new InitialContext();
            return (DeliveryStatusManageRemote) c.lookup("stateless/ManageDeliveryStatusJNDI");
        } catch (NamingException ne) {
            System.err.println("Namming not found ...");
            throw new RuntimeException(ne);
        }
    }

    public static AddTripRemote lookupAddTripService() {
        try {
            Context c = new InitialContext();
            return (AddTripRemote) c.lookup("stateful/AddTripJNDI");
        } catch (NamingException ne) {
            System.err.println("Namming not found ...");
            throw new RuntimeException(ne);
        }
    }

    public static ManageTripRemote lookupManageTripService() {
        try {
            Context c = new InitialContext();
            return (ManageTripRemote) c.lookup("stateless/ManageTripJNDI");
        } catch (NamingException ne) {
            System.err.println("Namming not found ...");
            throw new RuntimeException(ne);
        }
    }

    public static LoginServiceRemote lookupLoginService() {
        try {
            Context c = new InitialContext();
            return (LoginServiceRemote) c.lookup("stateless/LoginServiceJNDI");
        } catch (NamingException ne) {
            System.err.println("Namming not found ...");
            throw new RuntimeException(ne);
        }
    }
    public static BookingHistoryManageRemote lookupBookingHistoryManageRemote() {
        try {
            Context c = new InitialContext();
            return (BookingHistoryManageRemote) c.lookup("stateless/ManageBookingHistoryJNDI");
        } catch (NamingException ne) {
            //Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

}
